package top

import (
	"fmt"
	"go-interview-forum/model/top"
)

// OverallRanking 总榜
func OverallRanking() ([]top.Data, error) {
	tops, err := top.OverallRanking()
	if err != nil {
		return nil, fmt.Errorf("总榜错误")
	}

	return tops, nil
}

// GraspRanking 掌握榜
func GraspRanking() ([]top.Data, error) {
	tops, err := top.GraspRanking()
	if err != nil {
		return nil, fmt.Errorf("掌握榜错误")
	}

	return tops, nil
}

// LengthTimeRanking 时长榜
func LengthTimeRanking() ([]top.Data, error) {
	ranking, err := top.LengthTimeRanking()
	if err != nil {
		return nil, fmt.Errorf("时长榜错误")
	}
	return ranking, nil
}

// CategorizationRanking 分类榜
func CategorizationRanking(id int) ([]top.Data, error) {
	ranking, err := top.CategorizationRanking(id)
	if err != nil {
		return nil, fmt.Errorf("分类榜错误")
	}
	return ranking, nil
}
